#ifndef __SUBSYSTEM_GRASS_TRAP_BLOCK_BEHAVIOR_H__
#define __SUBSYSTEM_GRASS_TRAP_BLOCK_BEHAVIOR_H__

#include "Subsystems/BlockBehaviors/SubsystemBlockBehavior.hpp"
#include "GameRandom.hpp"
#include <map>
#include <vector>
#include <mutex>

namespace PocketSurvival
{
    class SubsystemTerrain;

    // 草皮陷阱
    class SubsystemGrassTrapBlockBehavior : public SubsystemBlockBehavior
    {
    protected:
        SubsystemTerrain *m_terrain;
        std::map<Point3, float> m_trapValues;
        std::mutex m_trapValuesMutex;

        std::vector<Point3> m_toRemove;

    public:
        SubsystemGrassTrapBlockBehavior();

        virtual void onCollide(const CellFace &cellFace, float velocity, ComponentBody *componentBody) override;
        virtual void update(float dt) override;
        virtual void load(const nlohmann::json &json) override;
        
        virtual const std::string& getName() const override;
        virtual SubUpdateType getUpdateType() override;
    };
}

#endif
